﻿namespace SandScript.Test
{
    using Moq;
    using Ninject;
    using Ninject.MockingKernel.Moq;

    public class Testable<T>
        where T : class
    {
        public Testable()
        {
            this.Kernel = new MoqMockingKernel();
        }

        public T Object
        {
            get
            {
                return this.Kernel.Get<T>();
            }
        }

        protected MoqMockingKernel Kernel { get; private set; }

        public void Inject<I>(I dependency)
            where I : class
        {
            this.Kernel.Inject(dependency);
        }

        public Mock<I> Mock<I>()
            where I : class
        {
            return this.Kernel.GetMock<I>();
        }
    }
}
